<?php
/**
 * Created by PhpStorm.
 * User: earl <guo@seosite.cn>
 * Date: 2017/7/28
 * Time: 下午4:35
 * Desc:
 */

namespace Admin\Model;

use Think\Model;

class SystemModel extends Model
{
    /**
     * @author Earl <guo@seosite.cn> from bayue.com
     * @desc 状态转ICO图标
     * @param $k
     * @return mixed
     */
    public function statusToIco($k)
    {
        $list[0] = '<span class="glyphicon glyphicon-remove"></span>';
        $list[1] = '<span class="glyphicon glyphicon-ok"></span>';
        return isset($k) ? $list[$k] : $list;
    }

    public function actStatusToIco($k)
    {
        $list[0] = '<span class="glyphicon glyphicon-remove"></span>';
        $list[1] = '<span class="glyphicon glyphicon-ok"></span>';
        $list[2] = '<span class="glyphicon glyphicon-remove"></span>';
        return isset($k) ? $list[$k] : $list;
    }

    /**
     * @author Earl <guo@seosite.cn> from bayue.com
     * @desc 状态转TEXT文字
     * @param $k
     * @return mixed
     */
    public function statusToText($k)
    {
        $list[0] = '禁用';
        $list[1] = '正常';
        return isset($k) ? $list[$k] : $list;
    }

    public function statusToTextIco($k)
    {
        $list[0] = '<font color="#f8ac59">禁用</font>';
        $list[1] = '<font color="#1ab394">使用中</font>';
        return isset($k) ? $list[$k] : $list;
    }

    public function VideoStatusToTextIco($k)
    {
        $list[0] = '<font color="#f8ac59">禁用</font>';
        $list[1] = '<font color="#1ab394">正常</font>';
        return isset($k) ? $list[$k] : $list;
    }

    /**
     * @author Earl <guo@seosite.cn> from bayue.com
     * @desc 标签转文字
     * @param $k
     * @return mixed
     */
    public function labelToText($k)
    {
        $list[1] = '活动';
        $list[2] = '视频';
        $list[3] = '直播';
        $list[4] = '相册';
        return isset($k) ? $list[$k] : $list;
    }

    /**
     * @author Earl <guo@seosite.cn> from bayue.com
     * @desc 标签转Key
     * @param $label
     * @return mixed
     */
    public function labelToK($label)
    {
        $list['activity'] = 1;
        $list['video'] = 2;
        $list['direct'] = 3;
        $list['picture'] = 4;
        return isset($label) ? $list[$label] : $list;
    }

}